﻿<%@ WebHandler Language="C#" Class="data" %>

using System;
using System.Web;
using System.Text;

public class data : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/xml";
        //context.Response.Write("Hello World");
        HttpRequest request = context.Request;
        HttpResponse response = context.Response;
        StringBuilder sb = new StringBuilder();
        sb.Append("<?xml version=\"1.0\"?>");
        if (request.QueryString["id"] != null)
        {
            if (request.QueryString["id"].ToString().Trim() == "1")
            {
                sb.Append("<pie>");
                sb.Append("<slice title=\"Category One\">3</slice>");
                sb.Append("<slice title=\"Category Two\">110</slice>");
                sb.Append("<slice title=\"Category Three\">294</slice>");
                sb.Append("<slice title=\"Category Four\">32</slice>");
                sb.Append("<slice title=\"Category Five\">2076</slice>");
                sb.Append("<slice title=\"Category Six\">355</slice>");
                sb.Append("<slice title=\"Category Seven\">821</slice>");
                sb.Append("</pie>");
            }
            else
            {
                if (request.QueryString["id"].ToString().Trim() == "2")
                {
                    sb.Append("<pie>");
                    sb.Append("<slice title=\"Category Eight\">123</slice>");
                    sb.Append("<slice title=\"Category night\">85</slice>");
                    sb.Append("<slice title=\"Category ten\">72</slice>");
                    sb.Append("<slice title=\"Category eleven\">113</slice>");
                    sb.Append("<slice title=\"Category twelve\">56</slice>");
                    sb.Append("<slice title=\"Category thirteen\">97</slice>");
                    sb.Append("</pie>");
                }
                else
                {
                    sb.Append("<pie>");
                    sb.Append("<slice title=\"Category fourteen\">26</slice>");
                    sb.Append("<slice title=\"Category fifteen\">12</slice>");
                    sb.Append("<slice title=\"Category sixteen\">344</slice>");
                    sb.Append("<slice title=\"Category seventeen\">456</slice>");
                    sb.Append("<slice title=\"Category eighteen\">-67</slice>");
                    //sb.Append("<slice title=\"Category thirteen\">578</slice>");
                    sb.Append("</pie>");
                }
            }

        }
        else
        {
            sb.Append("<pie>");
            sb.Append("<slice title=\"Category 1\">1234</slice>");
            sb.Append("<slice title=\"Category 2\">11</slice>");
            sb.Append("<slice title=\"Category 3\">455</slice>");
            sb.Append("<slice title=\"Category 4\">23</slice>");
            sb.Append("<slice title=\"Category 5\">1</slice>");
            //sb.Append("<slice title=\"Category 6\">927</slice>");
            sb.Append("</pie>");
        }
       
        response.Write(sb.ToString());

    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}